<div class="projects view">
<h2><?php  echo __('Project');?>: <?php echo $this->Html->link($project['Project']['domain'],'http://'.$project['Project']['domain']); ?></h2>
	<div class="actions selected">
		<?php 
			echo $this->Html->link(__('Domains'), array('action' => 'view',$project['Project']['id'],'p'=>'domains'),array('class'=>'action-left'));
			echo $this->Html->link(__('Meta tags'), array('action' => 'view',$project['Project']['id'],'p'=>'metas'),array('class'=>'action-inner'));
			//echo $this->Html->link(__('Jobs'), array('action' => 'view',$project['Project']['id'],'p'=>'jobs'),array('class'=>'action-inner'));
			echo $this->Html->link(__('Links'), array('action' => 'view',$project['Project']['id'],'p'=>'links'),array('class'=>'action-right','style'=>'margin-right: 25px;'));
		?>		
		<?php			
			echo $this->Html->link(__('Keywords'), array('action' => 'view',$project['Project']['id'],'p'=>'keywords'),array('class'=>'action-left'));
			echo $this->Html->link(__('Authorization'), array('action' => 'view',$project['Project']['id'],'p'=>'authorizations'),array('class'=>'action-right','style'=>'margin-right: 25px;'));
		?>	
		<?php 
			//echo $this->Html->link(__('Update statistics',true), array('action' => 'update',$project['Project']['id']),array('class'=>'action-left'));
			echo $this->Html->link(__('Setup',true), array('action' => 'edit',$project['Project']['id']),array('class'=>'action-left'));
			echo $this->Form->postLink(__('Delete',true), array('action' => 'delete', $project['Project']['id']), array('style'=>'margin-right: 25px;','class'=>'action-right'), __('Are you sure you want to delete # %s?', $project['Project']['id']));
		?>
		
		<?php 
// 			echo $this->Html->link(__('New Keyword'), array('controller' => 'keywords', 'action' => 'add','p'=>$project['Project']['id']),array('class'=>'action-left'));
// 			echo $this->Html->link(__('New Domain'), array('controller' => 'domains', 'action' => 'add','p'=>$project['Project']['id']),array('class'=>'action-inner'));
// 			echo $this->Html->link(__('New Link'), array('controller' => 'links', 'action' => 'add','p'=>$project['Project']['id']),array('class'=>'action-inner'));
// 			echo $this->Html->link(__('New Authorization'), array('controller' => 'authorizations', 'action' => 'add','p'=>$project['Project']['id']),array('class'=>'action-inner'));
// 			echo $this->Html->link(__('New Job'), array('controller' => 'jobs', 'action' => 'add','p'=>$project['Project']['id']), array('style'=>'margin-right: 25px;','class'=>'action-right'));
		?>
	</div>
	<div class="clear"></div>
	<dl>
		<dt><?php echo __('Name'); ?></dt>
		<dd>
			<?php echo h($project['Project']['name']); ?>
			&nbsp;
		</dd>
		<dt><?php echo __('Note'); ?></dt>
		<dd>
			<?php echo h($project['Project']['descriptions']); ?>
			&nbsp;
		</dd>
	</dl>
	
	
	<?php if(isset($this->passedArgs['p']) && $this->passedArgs['p'] == 'jobs'):?>
		<div class="related">
			<h3><?php echo __('Jobs');?></h3>
	
			<table cellpadding = "0" cellspacing = "0">
			<tr>
				<th><?php echo __('Id'); ?></th>
				<th><?php echo __('Status'); ?></th>
				<th><?php echo __('Priorytet'); ?></th>
				<th><?php echo __('Descriptions'); ?></th>
				<th><?php echo __('Date end'); ?></th>
				<th class="actions"><?php echo $this->Html->link(__('New Job'), array('controller' => 'jobs', 'action' => 'add','p'=>$project['Project']['id']));?></th>
			</tr>
			<?php
				if (!empty($project['Job']) ){
				$i = 0;
				foreach ($project['Job'] as $job): ?>
				<tr onclick="document.location='<?php echo $this->Html->url( array('controller' => 'jobs', 'action' => 'view', $job['id'],'p'=>$project['Project']['id']),true);?>'">
					<td><?php echo $job['id'];?></td>
					<td><?php echo $job['status'];?></td>
					<td><?php echo $job['priorytet'];?></td>
					<td><?php echo $job['description'];?></td>
					<td><?php echo h($job['date_end']); ?>&nbsp;</td>
					<td class="actions">
						<?php 
						echo $this->Html->link(__('View'), array('controller' => 'jobs', 'action' => 'view', $job['id'],'p'=>$project['Project']['id']),array('class'=>'action-left'));
						echo $this->Html->link(__('Edit'), array('controller' => 'jobs', 'action' => 'edit', $job['id'],'p'=>$project['Project']['id']),array('class'=>'action-inner'));
						echo $this->Form->postLink(__('Delete'), array('controller' => 'jobs', 'action' => 'delete', $job['id'],'p'=>$project['Project']['id']), array('style'=>'margin-right: 5px;','class'=>'action-right'), __('Are you sure you want to delete # %s?', $job['id'])); ?>
					</td>
				</tr>
			<?php endforeach; } ?>
			</table>	
		</div>
		<?php endif; ?>
		
		<?php if(isset($this->passedArgs['p']) && $this->passedArgs['p'] == 'metas'):?>
		<div class="related">
			<h3><?php echo __('Meta tags');?></h3>
	
			<table cellpadding = "0" cellspacing = "0">
			<tr>
				<th><?php echo __('Id'); ?></th>
				<th><?php echo __('Domain url'); ?></th>
				<th><?php echo __('Metas'); ?></th>
				<th class="actions">&nbsp;</th>
			</tr>
			<?php
				if (!empty($metas) ){
				$i = 0;
				foreach ($metas as $meta): ?>
				<tr onclick="document.location='<?php echo $this->Html->url( array('controller' => 'configurations', 'action' => 'edit',$meta['Configuration']['id'],'d'=>$meta['Domain']['id'],'p'=>$meta['Project']['id']),true);?>'">
					<td><?php echo $meta['Configuration']['id'];?></td>
					<td><?php echo $this->Html->link($meta['Domain']['name'],array('controller'=>'domains','action'=>'view',$meta['Domain']['id'],'d'=>'settings','p'=>$meta['Project']['id']));?></td>
					<td><?php echo nl2br(h($meta['Configuration']['value']));?></td>
					<td class="actions">
						<?php 
						echo $this->Html->link(__('Edit'), array('controller' => 'configurations', 'action' => 'edit',$meta['Configuration']['id'],'d'=>$meta['Domain']['id'],'p'=>$meta['Project']['id']));
						?>
					</td>
				</tr>
			<?php endforeach; } ?>
			</table>	
		</div>
		<?php endif; ?>
		
		
		<?php if(isset($this->passedArgs['p']) && $this->passedArgs['p'] == 'domains' || !isset($this->passedArgs['p'])):?>	
		<div class="related">
			<h3><?php echo __('Domains');?></h3>
	
			<table cellpadding = "0" cellspacing = "0">
			<tr>
				<th><?php echo __('Id'); ?></th>
				<th><?php echo __('Domain'); ?></th>
				<th><?php echo __('Note'); ?></th>
				<th><?php echo __('Server'); ?></th>
				<th><?php echo __('Servers IP'); ?></th>
				<th class="actions"><?php echo $this->Html->link(__('New Domain'), array('controller' => 'domains', 'action' => 'add','p'=>$project['Project']['id']));?></th>
			</tr>
			<?php if (!empty($project['Domain'])):?>
			<?php
				$i = 0;
				foreach ($project['Domain'] as $domain): ?>
				<tr <?php echo ($domain['project_domain']) ? 'class="project_domain"': '';?> onclick="document.location='<?php echo $this->Html->url( array('controller' => 'domains', 'action' => 'view', $domain['id'],'p'=>$project['Project']['id']),true);?>'">
					<td><?php echo $domain['id'];?></td>
					<td><?php echo $this->Html->link($domain['name'],'http://'.$domain['name'],array('target' => '_blank'));?></td>
					<td><?php echo $domain['descriptions'];?></td>
					<td><?php echo $domain['server_name'];?></td>
					<td><?php echo $domain['server_ip_value'];?></td>					
					<td class="actions">
						<?php 
						echo $this->Html->link(__('Setup'), array('controller' => 'domains', 'action' => 'edit', $domain['id'],'p'=>$project['Project']['id'])); 
						?>
					</td>
				</tr>
			<?php endforeach; ?>
			<?php endif;?>
			</table>	
		</div>
	<?php endif; ?>
		
	<?php if(isset($this->passedArgs['p']) && $this->passedArgs['p'] == 'keywords'):?>	
	<div class="related">
		<h3><?php echo __('Keywords');?></h3>
		<table cellpadding = "0" cellspacing = "0">
		<tr>
			<th><?php echo __('Id'); ?></th>
			<th><?php echo __('Keyword'); ?></th>
			<th><?php echo __('Position'); ?></th>
			<th><?php echo __('Searches'); ?></th>
			<th class="actions"><?php echo $this->Html->link(__('New Keyword'), array('controller' => 'keywords', 'action' => 'add','p'=>$project['Project']['id']));?></th>
		</tr>
		<?php if (!empty($project['Keyword'])):?>
		<?php
			$i = 0;
			foreach ($project['Keyword'] as $keyword): ?>
			<tr>
				<td><?php echo $keyword['id'];?></td>
				<td><?php echo $keyword['keyword'];?></td>
				<td><?php echo $keyword['position'];?></td>
				<td><?php echo $keyword['searches'];?></td>
				<td class="actions">
					<?php 
					echo $this->Html->link(__('View'), array('controller' => 'keywords', 'action' => 'view', $keyword['id'],'p'=>$project['Project']['id']),array('class'=>'action-left')); 
					echo $this->Html->link(__('Edit'), array('controller' => 'keywords', 'action' => 'edit', $keyword['id'],'p'=>$project['Project']['id']),array('class'=>'action-inner'));
					echo $this->Form->postLink(__('Delete'), array('controller' => 'keywords', 'action' => 'delete', $keyword['id'],'p'=>$project['Project']['id']), array('style'=>'margin-right: 5px;','class'=>'action-right'), __('Are you sure you want to delete # %s?', $keyword['id'])); ?>
				</td>
			</tr>
		<?php endforeach; ?>
		<?php endif;?>
		</table>	

	</div>
	<?php endif; ?>
	
	<?php if(isset($this->passedArgs['p']) && $this->passedArgs['p'] == 'authorizations'):?>
	<div class="related">
		<h3><?php echo __('Authorizations');?></h3>

		<table cellpadding = "0" cellspacing = "0">
		<tr>
			<th><?php echo __('Id'); ?></th>
			<th><?php echo __('Description'); ?></th>
			<th><?php echo __('Login'); ?></th>
			<th><?php echo __('Password'); ?></th>
			<th><?php echo __('Modified'); ?></th>
			<th class="actions"><?php echo $this->Html->link(__('New Authorization'), array('controller' => 'authorizations', 'action' => 'add','p'=>$project['Project']['id']));?></th>
		</tr>

		<?php if (!empty($project['Authorization'])):?>	
		<?php
			$i = 0;
			foreach ($project['Authorization'] as $authorization): ?>
			<tr>
				<td><?php echo $authorization['id'];?></td>
				<td><?php echo $this->Html->link($authorization['description'],'http://'.$authorization['web_url'],array('target' => '_blank'));?></td>
				<td><?php echo $authorization['login'];?></td>
				<td><?php echo $authorization['password'];?></td>				
				<td><?php echo $authorization['modified'];?></td>
				<td class="actions">
					<?php 
					echo $this->Html->link(__('View'), array('controller' => 'authorizations', 'action' => 'view', $authorization['id'],'p'=>$project['Project']['id']),array('class'=>'action-left'));
					echo $this->Html->link(__('Edit'), array('controller' => 'authorizations', 'action' => 'edit', $authorization['id'],'p'=>$project['Project']['id']),array('class'=>'action-inner')); 
					echo $this->Form->postLink(__('Delete'), array('controller' => 'authorizations', 'action' => 'delete', $authorization['id'],'p'=>$project['Project']['id']), array('style'=>'margin-right: 5px;','class'=>'action-right'), __('Are you sure you want to delete # %s?', $authorization['id'])); ?>
				</td>
			</tr>
		<?php endforeach; ?>
		<?php endif;?>
		</table>	
	</div>
	<?php endif; ?>
	
	
	
	<?php if(isset($this->passedArgs['p']) && $this->passedArgs['p'] == 'links'):?>
		<div class="related">
			<h3><?php echo __('Links');?></h3>
	
			<table cellpadding = "0" cellspacing = "0">
			<tr>
				<th><?php echo __('Id'); ?></th>
				<th><?php echo __('Backlink'); ?></th>
				<th><?php echo __('Target Url'); ?></th>
				<th><?php echo __('Anchor'); ?></th>
				<th><?php echo __('Price/M'); ?></th>							
				<th><?php echo __('Display Time'); ?></th>
				<th><?php echo __('Status'); ?></th>	
				<th class="actions"><?php echo $this->Html->link(__('New Link'), array('controller' => 'links', 'action' => 'add','p'=>$project['Project']['id']));?></th>
			</tr>
			<?php if (!empty($project['Link'])):?>	
			<?php
				$i = 0;
				foreach ($project['Link'] as $link): ?>
				<tr>
					<td><?php echo $link['id'];?></td>
					<td><?php 
					if (strpbrk($link['back_links'], ';') == FALSE) {
						echo $this->Html->link($link['back_links'],'http://'.$link['back_links'],array('target' => '_blank'));
					}else{
						$links = explode(';',$link['back_links']);
						$i = 0;
						foreach ($links as $lik) {
							echo ($i != 0) ? '<br/>':'';
							echo $this->Html->link($lik,'http://'.$lik,array('target' => '_blank'));
							$i++;
						}
					}
					?>&nbsp;</td>
					<td><?php echo $this->Html->link($link['target_links'],$link['target_links'],array('escape'=>false,'target' => '_blank')); ?>&nbsp;</td>
					<td><?php echo $link['anchor_text'];?></td>				
					<td><?php echo h($link['price_montchly']); ?>&nbsp;</td>									
					<td><?php echo h($link['display_time']); ?>&nbsp;</td>
					<td><?php echo h($link['status']); ?>&nbsp;</td>	
					<td class="actions">
						<?php 
						echo $this->Html->link(__('View'), array('controller' => 'links', 'action' => 'view', $link['id'],'p'=>$project['Project']['id']),array('class'=>'action-left'));
						echo $this->Html->link(__('Edit'), array('controller' => 'links', 'action' => 'edit', $link['id'],'p'=>$project['Project']['id']),array('class'=>'action-inner'));
						echo $this->Form->postLink(__('Delete'), array('controller' => 'links', 'action' => 'delete', $link['id'],'p'=>$project['Project']['id']), array('style'=>'margin-right: 5px;','class'=>'action-right'), __('Are you sure you want to delete # %s?', $link['id'])); 
						?>
					</td>
				</tr>
			<?php endforeach; ?>
			<?php endif; ?>
			</table>	
		</div>
	<?php endif; ?>
			
</div>
<div class="actions">	
	<?php echo $this->element('/menu/main')?>	
	<?php echo $this->element('/menu/settings')?>	
</div>

